package com.me.study.scanFilter;

import java.io.IOException;

import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;

/**
 * 自定义 @ComponentScan 过滤器
 *
 * @author ME
 * @date   2020/1/5
 */
public class MyExcludeTypeFilter implements TypeFilter {

	@Override
	public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory)
			throws IOException {
        String className = metadataReader.getClassMetadata().getClassName();
        if (className.startsWith("com.me.study.dao") || className.startsWith("com.me.study.service")) {
            return false;
        }
		return true;
	}
}
